template<class T>
void readInCarvano10(T myAst[], long indLastMPC, long indLastNumbMPC, string* ids, long nIds)
{
  char lineChar[255];
  ifstream myfile ("sdsstax_ast_table.tab");
  long ind;
  AsteroidWithPole ast;
  string line;

  if (myfile.is_open())
  {
    
    //    while (myfile.get(lineChar,226,10))
    //      {
    //	lineChar[224]=lineChar[225]=lineChar[226]=0;
    //	line.assign(lineChar);    
    while ( getline (myfile,line))
      {
	if (line.length()>1)
	  {
	    // convert linefile to asteroid
	    ast.Carvano10String2Asteroid(line);
	    //	    cout << ast.Number << " " << ast.Designation << " --> " << ast.tax << endl; cout.flush();
	    //	    ast.print(); fflush(stdout);
	    // if the asteroid is Numbered in the file assing it
	    if (ast.Number>0)
	      {
		memcpy(&myAst[ast.Number-1].taxClasses[24], &ast.taxClasses[24],3);
		myAst[ast.Number-1].hasTax=1;
		myAst[ast.Number-1].refs[6]+=CARVANO;
	      }
	    else
	      {
		//		cout << "unnumbered" << endl;
		// can you match is right there ?
		if ((ind = findUnnumberedAst(myAst,ast,indLastMPC,indLastNumbMPC+1))>=0) // YES ! 
		  {
		    //		    cout << "unnumbered matched with ind:" << ind << " designation " << myAst[ind].Designation << " " << myAst[ind].Number << endl;
		    memcpy(&myAst[ind].taxClasses[24],&ast.taxClasses[24],3);
		    myAst[ind].hasTax=1;
		    myAst[ind].refs[6]+=CARVANO;
		    //		    cout << "assigned tax" << endl;
		  }
		else
		  { // the designation could not be matched.
		    // try to see if the asteroid has been numbered LATER
		    ast.findId(ids,nIds);
		    if (ast.Number>0)
		      {
			//			cout << "cazzo " << ast.Number << " " << ast.Designation << " " << ast.pack << endl;
			memcpy(&myAst[ast.Number-1].taxClasses[24],&ast.taxClasses[24],3);
			myAst[ast.Number-1].hasTax=1;
			myAst[ast.Number-1].refs[6]+=CARVANO;
		      }
		    else
		      {
			if ((ind = findUnnumberedAst(myAst,ast,indLastMPC,indLastNumbMPC+1))>=0) // YES ! 
			  {
			    memcpy(&myAst[ind].taxClasses[24],&ast.taxClasses[24],3);
			    myAst[ind].hasTax=1;
			    myAst[ind].refs[6]+=CARVANO;
			  }
			else
			  {
			    cout << ">>match FAILED  " << ast.Designation << "--" << line << endl;
			  }
		      }
		  }
	      }
	  }
     }
    myfile.close();
  }
  else cout << "Unable to open file"; 
}
